﻿using Volo.Abp.DependencyInjection;
using YAPACS.BusinessObjects.Exams;
using YAPACS.Workflows;

namespace YAPACS.RisServer.Workflows.Register;

public class CancelPending : WorkflowBase, ICancelPending, ITransientDependency
{
    protected override async Task<WorkflowOutput> InvokeCoreAsync(WorkflowInput input)
    {
        const string key = "Exams";
        if (input.ContainsKey(key) && input.GetValueOrDefault(key) is IList<Exam> exams)
        {
            //处理逻辑
            return await Task.FromResult(new WorkflowOutput
            {
                Success = true,
                Data = exams.Select(e => e.Oid)
            });
        }

        return await Task.FromResult(new WorkflowOutput
        {
            Success = false,
            Error = "未找到Exam对象",
        });
    }
}
